import request from '../request'

// 成绩管理相关API
export const gradeApi = {
  // 获取成绩列表
  getGradeList(params) {
    return request({
      url: '/grades',
      method: 'get',
      params
    })
  },
  
  // 获取学生成绩
  getStudentGrades(studentId, params) {
    return request({
      url: `/students/${studentId}/grades`,
      method: 'get',
      params
    })
  },
  
  // 录入成绩
  addGrade(data) {
    return request({
      url: '/grades',
      method: 'post',
      data
    })
  },
  
  // 批量录入成绩
  batchAddGrades(data) {
    return request({
      url: '/grades/batch',
      method: 'post',
      data
    })
  },
  
  // 更新成绩
  updateGrade(id, data) {
    return request({
      url: `/grades/${id}`,
      method: 'put',
      data
    })
  },
  
  // 删除成绩
  deleteGrade(id) {
    return request({
      url: `/grades/${id}`,
      method: 'delete'
    })
  },
  
  // 成绩统计分析
  getGradeStatistics(params) {
    return request({
      url: '/grades/statistics',
      method: 'get',
      params
    })
  },
  
  // 导出成绩单
  exportGrades(params) {
    return request({
      url: '/grades/export',
      method: 'get',
      params,
      responseType: 'blob'
    })
  }
}